#ifndef LOGGERFORTRT_H
#define LOGGERFORTRT_H

#include <QObject>
#include <QFile>
#include <QTextStream>

#include "NvInferRuntimeCommon.h"

class LoggerForTRT:public QObject,public nvinfer1::ILogger
{
    Q_OBJECT

public:
    explicit LoggerForTRT(QObject *parent=nullptr);
    void setIsBuildingEngine(bool isBuildingEngine);

    // ILogger interface
    void log(Severity severity, const nvinfer1::AsciiChar *msg) noexcept;

signals:
    ///
    /// \brief toastInfo
    /// \param info
    /// \param color
    ///弹出信息到 信息栏
    void toastInfo(QString info,QString color="black");

    ///
    /// \brief toastVerbose
    /// \param info
    /// \param color
    /// 弹出冗余信息
    void toastVerbose(QString info,QString color="black");

private:
    bool m_isBuildingEngine;

    QFile logfile;
    QTextStream logstream;
};

#endif // LOGGERFORTRT_H
